package cn.hamster3.hamsterworld.event;

import org.bukkit.WorldCreator;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import java.util.UUID;

/**
 * 这个事件代表着私人世界将要创建
 */
@SuppressWarnings("unused")
public class PrivateWorldPreCreateEvent extends Event implements Cancellable {
    private static HandlerList handlerList = new HandlerList();
    private WorldCreator worldCreator;
    private UUID owner;
    private boolean cancelled;

    public PrivateWorldPreCreateEvent(WorldCreator worldCreator, UUID owner) {
        this.worldCreator = worldCreator;
        this.owner = owner;
    }

    public static HandlerList getHandlerList() {
        return handlerList;
    }

    /**
     * 获取用于创建世界的WorldCreator对象
     *
     * @return 创建器
     */
    public WorldCreator getWorldCreator() {
        return worldCreator;
    }

    /**
     * 获取用于创建世界的WorldCreator对象
     *
     * @param worldCreator 创建器
     */
    public void setWorldCreator(WorldCreator worldCreator) {
        this.worldCreator = worldCreator;
    }

    public UUID getOwner() {
        return owner;
    }

    @Override
    public boolean isCancelled() {
        return cancelled;
    }

    @Override
    public void setCancelled(boolean cancelled) {
        this.cancelled = cancelled;
    }

    @Override
    public HandlerList getHandlers() {
        return handlerList;
    }
}
